#include<unistd.h>
#include<stdio.h>
#include<sys/file.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<malloc.h>

int main() {
  printf("wait_process start.\n");
  int fd = open("a.txt", O_RDONLY);
  char *buf = (char *)malloc(sizeof(char) * 3);
  flock(fd, LOCK_SH);
  int ret =  read(fd, buf, 5);
  if (ret > 0) {
    printf("read success\n");
    printf(buf);
  } else {
    printf("read failed.\n");
  }


}
